/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.UserVOIPManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.sql.SQLException;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class DeleteVOIPSetting extends AbstractAction
/*    */ {
/* 30 */   private static Logger logger = Logger.getLogger(DeleteVOIPSetting.class
/* 31 */     .getName());
/*    */ 
/* 33 */   private String id = null;
/*    */ 
/*    */   public DeleteVOIPSetting(AbstractHttpServlet servlet, String id) {
/* 36 */     super(servlet);
/* 37 */     this.id = id;
/*    */   }
/*    */ 
/*    */   public DeleteVOIPSetting(AbstractHttpServlet servlet) {
/* 41 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 47 */     response.setContentType("text/html;charset=utf-8");
/* 48 */     PrintWriter out = response.getWriter();
/* 49 */     JSONObject jsonObject = new JSONObject();
/*    */ 
/* 51 */     User user = super.getLoginUser(request);
/*    */ 
/* 53 */     if ((!user.userId.equals(this.id)) && (!user.isAdmin)) {
/* 54 */       super.showErrorMessage(response, "您没有操作的权限");
/* 55 */       return;
/*    */     }
/*    */ 
/* 58 */     UserVOIPManager manager = new UserVOIPManager();
/*    */     try
/*    */     {
/* 61 */       manager.clear(user.companyId, this.id);
/*    */     } catch (SQLException|DBException e) {
/* 63 */       logger.warn("delete user voip setting failed", e);
/*    */     }
/* 65 */     jsonObject.put("error", "0");
/* 66 */     out.println(jsonObject);
/* 67 */     out.flush();
/* 68 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.DeleteVOIPSetting
 * JD-Core Version:    0.6.1
 */